window.onload=function(){
      //===============================往前移动特效=============================
      console.log('hello js');
      var oImg=document.querySelectorAll('img');
      var oWrap=document.querySelector('.wrap');
      var lastX,lastY,nowX,nowY,minusX,minusY,roY=0,roX=-10;
      var timer=null;
      // -----------------
      var length=oImg.length;
      console.log('------------------------'+length)
      var Deg=360/length;
      
      for(var i=0;i<length;i++){
            // translateZ
            oImg[i].style.transform='rotateY('+i*Deg+'deg) translateZ(350px))';
            console.log(i*Deg+'deg')
            console.log(oImg[i].style.transform)
            oImg[i].style.transform='transform 1s '+(length-1-i)*0.2+'s'
      }
      mTop();

      window.onresize=mTop;
      function mTop(){
            console.log('mTop')
            var wH=document.documentElement.clientHeight||document.body.clientHeight;
            oWrap.style.marginTop=(wH/2)-oWrap.offsetHeight+'px';
      }
      //----------===============================鼠标拖动特效=============================================
      document.onmousedown=function(e){
            console.log('down')
            e=e||window.event;
            lastX=e.clientX;
            lastY=e.clientY;
            clearInterval(timer);
            document.onmousemove=function(e){
                  console.log('move')
                  e=e||window.event;
                  nowX=e.clientX;
                  nowY=e.clientY;
                  minusX=nowX-lastX;
                  minusY=nowY-lastY;
                  roY=minusY*0.2;
                  roX=minusX*0.1;
                  oWrap.style.transform='rotateX('+roX+'deg) rotateY('+roY+'deg';
                  lastX=nowX;
                  lastY=nowY;
            }
            document.onmouseup=function(){
                  document.onmousemove=null;
                  timer=setInterval(function(){
                        minusX*=0.9;
                        minusY*=0.9;
                        roY+=minusY*0.2;
                        roX-=minusX*0.1;
                        oWrap.style.transform='rotateX('+roX+'deg) rotateY('+roY+'deg';
                        if(Math.abs(minusX)<0.1&&Math.abs(minusY)<0.1){
                              clearInterval(timer);
                        }
                  },12);
                        
               
            }
            return false;
      }
}